package old.coordinate;

import stars.starSystems.StarSystemModel;
import view.View;

import com.jme3.input.controls.ActionListener;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.texture.Texture;


public class CoordinateView extends View implements ActionListener {
	
	private Geometry geometry;
	private Material material;
	private Texture texture;
	private CoordinateModel coordinate = (CoordinateModel) model;
	
	public CoordinateView(Material material, Texture texture) {
		this.material = material;
		this.texture = texture;
		loadInputListeners();
	}
	
	public void initView(){
		String identifier = String.valueOf(coordinate.getKey().getValue());
		geometry = new Geometry(identifier, new Box(Vector3f.ZERO, 1.0f,1.0f,1.0f));
		update();
	}	
	
	public void update() {
		updateMaterial();
		updateTexture();
		
		//Normal way to do it with a texture
		//material.setTexture("ColorMap", texture);
		
		//Temporary way, for testing with just a color
		material.setColor("m_Color", ColorRGBA.Green);
		geometry.setMaterial(material);		
		
		//update location
		geometry.setLocalTranslation(coordinate.getLocation());		
	}
	
	private void updateMaterial() {
		
		
	}

	private void updateTexture() {
		
	}
	
	public Geometry getGeometry() {
		return this.geometry;
	}
	
	public CoordinateModel getModel() {
		return this.coordinate;
	}

	public void onAction(String arg0, boolean arg1, float arg2) {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void loadInputListeners() {
		// TODO Auto-generated method stub
		
	}
	
	

}
